<?php
session_start ();
include ('config.php');
include ('include/weibooauth.php');
include ('include/functions.php');
switch ($_SERVER ['PHP_SELF']) {
	case '/index.php' :
		if (isset ( $_SESSION ['last_key'] )) {
			header ( "Location: home.php" );
			die ();
		}
		break;
	case '/callback.php' :
		if (isset ( $_SESSION ['last_key'] )) {
			header ( "Location: home.php" );
			die ();
		}
		break;
	default :
		if (! isset ( $_SESSION ['last_key'] )) {
			header ( "Location: index.php" );
			die ();
		}
		break;
}